package com.example.dto;

import lombok.Getter;

/**
 * @author zhangs
 * @version v1.0
 * @decription
 * @date 2021/4/4 20:04
 **/
@Getter
public enum SexEnum {
    UNKNOWN(0, "未知"),
    MAN(1, "男"),
    FEMALE(2, "女");

    private int code;
    private String message;

    SexEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public static SexEnum getInstanceByCode(int code) {
        for (SexEnum value : SexEnum.values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return null;
    }
}
